<template>
  <div>
    <!-- 发送请求测试按钮 -->
    <button @click="handlerSend">发送请求</button>
    <p>返回的数据{{data}}</p>
  </div>
</template>
<script setup>
//导入axios
import axios from 'axios';
import { ref } from 'vue';

const data = ref('');

//处理按钮的点击事件
const handlerSend = () => {
  console.log('发送请求');
  axios.post('/api/user/login',{
    username:'admin',
    password:'123456'
  }).then(res => {
    console.log(res);
    data.value = res.data;
  }).catch(err => {
    console.log(err);
  })
}
</script>